package org.jackysoft.struts2.business;
import java.util.Collection;

import javax.annotation.Resource;

import org.apache.struts2.convention.annotation.Namespace;
import org.jackysoft.entity.ReportReseted;
import org.jackysoft.service.ReportResetedService;
import org.jackysoft.struts2.UtilsCRUDAction;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Scope;



@Namespace("/reportreseted")
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
public class ReportResetedAction extends UtilsCRUDAction<ReportReseted> {
	/**
	 * 
	 */
	private static final long serialVersionUID = -5167035681996482859L;
	private ReportResetedService service;
	private ReportReseted bean;
	private Collection<ReportReseted> beans;	
	
	
	
	public String check() throws Exception{
		service.checkResetable(bean.getDepartment(), bean.getDueDate());
		return "get";
	}
	
	public String toggle() throws Exception{
		service.toggleResetable(bean.getDepartment(), bean.getDueDate(),bean.isResetable());
		
		return "update";
	}
	
	
	
	
	public void setBean(ReportReseted bean){
	     this.bean = bean;
	}
	public ReportReseted getBean(){
	     return this.bean;
	}
	public void setBeans(Collection<ReportReseted> beans){
	
	     this.beans = beans;
	}
	public Collection<ReportReseted> getBeans(){
	     return this.beans;
	}
	
	@Resource
	public void setService(ReportResetedService service) {
		this.service = service;
		this.setDataProvider(service);
	}	
	
	public ReportResetedService getService(){
	   return this.service;
	}
		
}